@use "../variables" as *;
@use "sass:color";

.farm-designer-panels {
  position: fixed;
  top: 9rem;
  width: 45rem;
  margin: 1.25rem;
  margin-top: 0;
  overflow-y: scroll;
  border-radius: 1rem;
  @media screen and (max-width: $mobile_max_width) {
    top: 15rem;
    width: 100vw;
    margin: 0;
  }
  &.short-panel {
    max-height: 19rem;
  }
}

.panel-nav {
  position: fixed;
  top: 10rem;
  width: 100vw;
  display: none;
  overflow-x: scroll;
  z-index: 11;
  @media screen and (max-width: $mobile_max_width) {
    display: block;
  }
}

.panel-content {
  padding: 1rem;
  a {
    color: inherit;
    text-decoration: underline !important;
  }
}

.group-detail-panel {
  .panel-content {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
  }
}

.point-inventory-panel,
.plant-inventory-panel {
  .panel-content {
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: inherit;
  }
}

.curve-info-panel,
.weed-info-panel,
.point-info-panel,
.plant-info-panel {
  .panel-content {
    overflow-y: auto;
    overflow-x: hidden;
  }
}

.weed-info-panel {
  .panel-title {
    color: $dark_gray;
  }
}

.weeds-inventory-panel,
.zones-inventory-panel,
.groups-panel {
  .panel-content {
    overflow-y: auto;
    overflow-x: hidden;
  }
}

.farm-designer-panels {
  bottom: 0;
  z-index: 1;
  animation: panel-show 0.3s ease forwards;
  pointer-events: none;
  &.panel-closed-mobile,
  &.panel-closed {
    animation: panel-hide 0.3s ease forwards;
  }
  .panel-container {
    width: 100%;
    border-radius: 1rem;
    overflow-x: hidden;
    font-size: 1.6rem;
    pointer-events: auto;
    overflow: hidden;
    box-shadow: 0 0 1rem $translucent;
    background-color: var(--main-bg);
    color: var(--text-color);
    div[class*="search-item"] {
      &:hover,
      &.hovered {
        background: $translucent2_white;
      }
    }
    label {
      font-size: 1.3rem;
    }
  }
}

.panel-nav,
.panel-header {
  &.green-panel {
    background-color: $panel_green;
  }
  &.cyan-panel {
    background-color: $cyan;
  }
  &.brown-panel {
    background-color: $panel_brown;
  }
  &.magenta-panel {
    background-color: $magenta;
  }
  &.gray-panel {
    background-color: $translucent3;
  }
  &.light-gray-panel{
    background-color: $panel_medium_light_gray;
  }
  &.yellow-panel {
    background-color: $panel_yellow;
  }
  &.blue-panel {
    background-color: $panel_blue;
  }
  &.navy-panel {
    background-color: $panel_navy;
  }
  &.teal-panel {
    background-color: $panel_teal;
  }
  &.red-panel {
    background-color: $panel_red;
  }
}

.panel-tabs {
  display: flex;
  overflow-x: scroll;
  &::-webkit-scrollbar {
    display: none;
  }
  img, .fa {
    filter: brightness(0%) invert(100%);
    opacity: 0.8;
  }
  i {
    font-size: 3rem;
    margin-top: 1rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  a {
    display: block;
    flex: 1;
    text-align: center;
    text-transform: uppercase;
    font-size: 1.4rem;
    line-height: 5rem;
    height: 5rem;
    color: $light_gray;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
    &.active {
      border-bottom: 3px solid $white;
      font-weight: bold;
      color: $white;
      img {
        opacity: 1;
      }
    }
    &:hover {
      color: $off_white;
      text-decoration: none;
      font-weight: bold;
    }
    &:focus {
      color: $off_white;
      text-decoration: none;
      font-weight: bold;
    }
  }
}

.panel-title {
  overflow: hidden;
  .back-arrow {
    float: left;
    text-align: center;
    font-size: 1.8rem;
    width: 50px;
    line-height: 50px;
  }
  .title {
    font-size: 1.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .right-button {
    position: absolute;
    right: 0;
    float: right;
    text-transform: uppercase;
    font-size: 1rem;
    border: 1px solid;
    padding: 0.4rem 1.2rem;
    font-weight: bold;
    letter-spacing: 1px;
    border-radius: 4px;
    color: $off_white;
    margin-top: 1.25rem;
    margin-right: 1.5rem;
    &:hover {
      color: $white;
    }
  }
  button {
    margin-left: 4px;
  }
}

.weed-info-panel-content,
.point-info-panel-content {
  font-size: 1.4rem;
  .point-color-input {
    div[class*=col-] {
      padding-left: 0.5rem;
    }
    .saucer {
      margin-top: 4.5rem;
    }
  }
  .fb-button & .red {
    display: block;
    margin-top: 3rem;
  }
  p {
    margin-top: 1rem;
    margin-bottom: 0.5rem !important;
    font-size: 1.2rem;
  }
  .weed-removal-method-section {
    .weed-removal-method {
      display: flex;
      input {
        margin: 0;
        width: 10%;
        box-shadow: none;
      }
      label {
        margin: 0;
        margin-top: auto;
        font-size: 1.25rem;
        font-weight: normal;
      }
    }
  }
}

.panel-top {
  padding: 1rem;
  &.with-button {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
  }
}

.scroll-indicator {
  position: absolute;
  top: 0;
  right: 0;
  width: 2rem;
  height: 100%;
  background: linear-gradient(-90deg, $translucent, transparent)
}

.panel-header {
  .panel-header-description,
  .crop-info-description {
    font-size: 1.2rem;
    padding: 0 1.4rem 1rem;
  }
  .crop-info-description {
    height: 8rem;
    overflow-y: auto;
    overflow-x: hidden;
    width: calc(100% - 75px);
    font-family: "Cabin", sans-serif;
  }
  .saving-indicator {
    position: absolute;
    right: 7rem;
    line-height: 6rem;
    color: $white;
    i {
      margin-right: 1rem;
      color: $white;
    }
  }
  .crop-drag-info-tile {
    position: absolute;
    top: 0;
    right: 0;
    margin: 1rem;
    border: 2px solid $white;
    border-radius: 50%;
  }
}

.dark-portal {
  .bp5-popover-content {
    background: $dark_gray;
    color: $off_white;
  }
}

.grid-popup-content {
  width: 25rem;
}

.grid-input {
  .use-current-location {
    display: inline;
    float: none;
    span,
    button {
      display: inline;
      float: none;
    }
    button {
      width: 2.25rem;
      padding-left: 0;
    }
  }
}

.weeds-inventory-panel-content,
.plant-panel-content,
.points-panel-content {
  padding: 0!important;
  .non-empty-state {
    margin-bottom: 1rem;
    gap: 0;
  }
}

.panel-section {
  .delete {
    height: 2rem;
  }
}

.section-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  height: 4rem;
  padding: 0 1rem;
  cursor: pointer;
  &:hover {
    background: $translucent2_white;
  }
  label {
    cursor: pointer;
  }
  .fb-button {
    line-height: 1.2rem;
  }
  .fa-caret-up,
  .fa-caret-down {
    font-size: 2rem;
  }
}

.grid-and-row-planting {
  position: relative;
  .bp5-collapse-body {
    display: grid;
    gap: 1rem;
  }
  .fa-chevron-down,
  .fa-chevron-up {
    position: absolute;
    right: 1rem;
    top: 0.5rem;
    font-size: 1.5rem;
  }
  h3 {
    width: 100%;
    text-align: center;
    margin: 0;
  }
  .fa-arrows-h, .fa-arrows-v {
    margin-left: 0.5rem;
  }
  .use-current-location {
    display: flex;
    align-items: center;
    button {
      .fa {
        font-size: 1.5rem;
      }
    }
  }
  .fb-toggle-button {
    float: none;
    margin-left: 1rem;
  }
  .update-button,
  .preview-button,
  .cancel-button,
  .save-button {
    text-decoration: none !important;
  }
}

.move-to-form {
  display: grid;
  gap: 1rem;
  .bp5-popover-wrapper {
    display: inline;
    margin-left: 0.5rem;
  }
}

.no-pad {
  padding: 0;
}

.low-pad {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.factory-reset-options {
  a {
    color: $white;
    text-decoration: none !important;
  }
  .fa-external-link {
    margin-left: 0.5rem;
  }
}

.weed-item-icon,
.group-item-icon {
  display: inline-block;
  position: relative;
  .weed-icon {
    position: absolute;
    top: 11%;
    left: 14%;
    width: 70%;
    height: 70%;
  }
  &.more-indicator {
    height: 20px;
    width: 20px;
    cursor: pointer;
    p {
      display: inline;
      text-align: center;
    }
  }
}

.panel-header-icon-group {
  margin-left: 1rem;
  margin-right: 1.5rem;
}

.group-detail-panel {
  .panel-content {
    .group-criteria {
      .basic, .plant-criteria-options {
        display: grid;
        gap: 1rem;
      }
      .plant-stage-criteria,
      .plant-type-criteria,
      .radius-criteria,
      .day-criteria,
      .location-criteria,
      .removal-method-criteria,
      .color-criteria,
      .point-source-criteria {
        background: var(--secondary-bg);
        border-radius: 0.5rem;
        padding: 1rem;
        display: grid;
        gap: 1rem;
      }
      .criteria-heading {
        margin-top: 0;
      }
      .alpha-icon {
        display: inline;
        float: none !important;
        margin-left: 1rem;
        color: $orange;
        font-size: 1.4rem;
      }
      p {
        &.category {
          font-size: 1.2rem;
          font-weight: bold;
        }
      }
      .bp5-popover-wrapper {
        float: right;
      }
      .criteria-checkbox-list {
        display: flex;
        gap: 1rem;
        flex-wrap: wrap;
      }
      .point-type-section,
      .criteria-checkbox-list-item {
        height: 3rem;
        border-radius: 3rem;
        display: flex;
        align-items: center;
        padding: 0 1rem;
        gap: 1rem;
        background: $translucent2_white;
        .fb-checkbox {
          display: contents;
        }
        p {
          text-transform: uppercase;
        }
        input[type="text"] {
          width: 50%;
          height: 2rem;
        }
      }
      .point-type-checkboxes {
        .point-type-section {
          .point-type-checkbox {
            position: relative;
            height: 2rem;
            margin-top: 0.75rem;
            cursor: pointer;
            .fb-checkbox {
              display: inline-block;
              height: 2rem;
            }
          }
          .plant-criteria-options,
          .weed-criteria-options,
          .point-criteria-options,
          .tool-criteria-options {
            .lt-gt-criteria {
              margin-bottom: 1rem;
              .row {
                margin-left: 0 !important;
              }
            }
          }
        }
      }
      .criteria-radio-presets {
        input[type="radio"] {
          width: auto;
          margin-right: 1rem;
        }
        p {
          display: inline;
          text-transform: uppercase;
        }
      }
      .criteria-string,
      .criteria-pointer-type,
      .criteria-plant-status,
      .criteria-slug {
        margin-top: 1rem;
      }
      .number-eq-criteria,
      .string-eq-criteria {
        code {
          display: inline-block;
          font-size: 1.2rem;
          font-weight: bold;
          color: $black;
        }
      }
      .number-eq-criteria,
      .number-gt-lt-criteria {
        p {
          text-align: center;
          font-size: 1.2rem;
        }
      }
      .advanced {
        .bp5-popover-wrapper {
          display: inline-block;
          float: none;
          margin-left: 1rem;
          font-size: 1.4rem;
        }
        .filter-search {
          .bp5-popover-wrapper {
            margin-left: 0;
          }
        }
      }
    }
  }
}

.group-member-count-breakdown {
  margin-bottom: 1rem;
  .manual-group-member-count,
  .criteria-group-member-count {
    margin-bottom: 0.5rem;
    div {
      display: inline;
      padding: 0.25rem;
      font-size: 1.2rem;
    }
    p {
      display: inline;
      margin-left: 0.5rem;
    }
    .fb-button {
      margin: 0;
    }
  }
}

.lt-gt-criteria,
.location-criteria {
  .row {
    p {
      text-transform: uppercase;
      font-size: 1.1rem;
    }
  }
  .location-selection-warning {
    i,
    p {
      display: inline;
      margin-right: 1rem;
      color: $darkest_red;
    }
  }
}

.weeds-inventory-panel,
.zones-inventory-panel,
.point-inventory-panel,
.groups-panel {
  .panel-content {
    .points-section-header {
      cursor: pointer;
      height: 4rem;
      line-height: 2.75rem;
      label {
        cursor: pointer;
      }
      .saucer {
        display: inline-block;
        height: 3rem;
        width: 3rem;
        vertical-align: middle;
        margin-right: 0.25rem;
        margin-left: 1rem;
      }
    }
    .points-section {
      &.open {
        margin-bottom: 1rem;
      }
      .row {
        padding: 0 1rem;
      }
    }
    .no-points,
    .no-weeds {
      margin-left: 1rem;
      padding-bottom: 1rem;
    }
    .fa-caret-down,
    .fa-caret-up {
      margin: 1rem;
    }
    button {
      float: none;
    }
    .approval-buttons {
      i {
        padding-right: 0.5rem;
      }
    }
    .pending-weeds {
      .fa-check {
        margin: 0 !important;
      }
    }
  }
}

.sensors-panel,
.controls-panel {
  .panel-content {
    .widget-wrapper {
      box-shadow: none;
      .widget-header {
        background: none;
        h5 {
          color: $dark_gray;
        }
      }
      .widget-body {
        background: none;
        border: none;
      }
      .widget-footer {
        background: none;
        * {
          color: $dark_gray;
        }
      }
    }
  }
}

.desktop-hide {
  display: none !important;
  @media screen and (max-width: 1075px) {
    display: block !important;
  }
}
